package com.dili.dd.gpi.mapper;

import com.dili.dd.gpi.domain.SiteApp;
import com.dili.dd.gpi.domain.SiteAppExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface SiteAppMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site_app
     *
     * @mbggenerated Tue Oct 20 10:08:43 CST 2015
     */
    int countByExample(SiteAppExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site_app
     *
     * @mbggenerated Tue Oct 20 10:08:43 CST 2015
     */
    int deleteByExample(SiteAppExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site_app
     *
     * @mbggenerated Tue Oct 20 10:08:43 CST 2015
     */
    @Delete({
        "delete from site_app",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site_app
     *
     * @mbggenerated Tue Oct 20 10:08:43 CST 2015
     */
    @Insert({
        "insert into site_app (site_id, `key`, ",
        "`type`, ",
        "deleted)",
        "values (#{siteId,jdbcType=INTEGER}, #{key,jdbcType=VARCHAR}, ",
        "#{appType,jdbcType=VARCHAR,typeHandler=org.apache.ibatis.type.EnumTypeHandler}, ",
        "#{deleted,jdbcType=BIT})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(SiteApp record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site_app
     *
     * @mbggenerated Tue Oct 20 10:08:43 CST 2015
     */
    int insertSelective(SiteApp record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site_app
     *
     * @mbggenerated Tue Oct 20 10:08:43 CST 2015
     */
    List<SiteApp> selectByExample(SiteAppExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site_app
     *
     * @mbggenerated Tue Oct 20 10:08:43 CST 2015
     */
    @Select({
        "select",
        "id, site_id, `key`, `type`, deleted",
        "from site_app",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    SiteApp selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site_app
     *
     * @mbggenerated Tue Oct 20 10:08:43 CST 2015
     */
    int updateByExampleSelective(@Param("record") SiteApp record, @Param("example") SiteAppExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site_app
     *
     * @mbggenerated Tue Oct 20 10:08:43 CST 2015
     */
    int updateByExample(@Param("record") SiteApp record, @Param("example") SiteAppExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site_app
     *
     * @mbggenerated Tue Oct 20 10:08:43 CST 2015
     */
    int updateByPrimaryKeySelective(SiteApp record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site_app
     *
     * @mbggenerated Tue Oct 20 10:08:43 CST 2015
     */
    @Update({
        "update site_app",
        "set site_id = #{siteId,jdbcType=INTEGER},",
          "`key` = #{key,jdbcType=VARCHAR},",
          "`type` = #{appType,jdbcType=VARCHAR,typeHandler=org.apache.ibatis.type.EnumTypeHandler},",
          "deleted = #{deleted,jdbcType=BIT}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(SiteApp record);
}